package com.lzs.bootsafety.business.logs.controller;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.lzs.bootsafety.business.logs.entity.SysExc;
import com.lzs.bootsafety.business.logs.service.SysExcService;
import com.lzs.bootsafety.common.base.controller.BaseController;
import com.lzs.bootsafety.common.util.Resu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author  zhanshi Liu
 * @date    2020/04/15
 * @website www.jhmsona.cn
 */
@RestController
@RequestMapping("/log/exc")
public class SysExcController extends BaseController {
    @Autowired
    private SysExcService sysExcService;
    @GetMapping("/info")
    public Resu info(Long excId){
        SysExc sysExc = sysExcService.getByPrimaryKey(excId);
        return Resu.suces().put("data",sysExc);
    }
    @GetMapping("/list")
    public Resu list(@RequestParam("data") String data){
        SysExc sysExc = JSON.parseObject(data,SysExc.class);
        PageInfo<SysExc> pageInfo = sysExcService.getSysExc(sysExc);
        return Resu.page(pageInfo.getList(),pageInfo.getTotal(),200);
    }


}
